REM gendoc just runs doxygen over a set of doxygen configuration files.
REM Thus doxygen needs to be available 
REM (cf: http://www.stack.nl/~dimitri/doxygen/download.html).

REM Note that doxygen itself depends on another tool named graphviz. If you want
REM to get nice graphical views in the generated doc, graphviz must be installed 
REM too. (cf: http://www.research.att.com/sw/tools/graphviz/download.html).

REM gendoc runs HTML help workshop compiler too.
REM This Html Help workshop compiler needs to be available too.

REM The first argument of this commmand is the name of the dox file 
REM The second argument is the name of the generated chm file, as defined in the dox file.

cd /d "..\.."

set DOCPATH="%1"
set DOCFILE="%2"

rmdir /s /q ".\doc\%DOCPATH%"

mkdir ".\doc\%DOCPATH%\"
copy ".\doc\left.png" ".\doc\%DOCPATH%\left.png"
copy ".\doc\right.png" ".\doc\%DOCPATH%\right.png"

copy /Y ".\doc\%DOCFILE%.chm" ".\doc\%DOCFILE%.chm.bak"
del /q /f ".\doc\%DOCFILE%.chm"

REM chm is automatically built via doxygen
doxygen ".\doc\%1.dox"

:end
if errorlevel 1 goto restorebackup

exit

:restorebackup
copy /Y ".\%DOCFILE%.chm.bak" ".\%DOCFILE%.chm"
goto end
